package com.zlm.unsafe;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Author: 郑
 *  ConcurrentModificationException
 */
public class MapTest {
    public static void main(String[] args) {
        //Map<String, Object> map = new HashMap<>(16,0.75f);
        //Map<String, Object> map = Collections.synchronizedMap(new HashMap<>());
        Map<String, Object> map = new ConcurrentHashMap<>();
        //Map<String, Object> map = new ConcurrentSkipListMap<>();
        for (int i = 0; i < 50; i++) {
            final String temp = String.valueOf(i);
            new Thread(() ->{
                map.put(temp,temp);
                System.out.println(map);
            }).start();
        }
    }
}
